﻿<!DOCTYPE html>
<html>
<head>
    <title>JS Conditional Exercise 5</title>
    <link href="styles/js-console.css" rel="stylesheet" />
</head>
<body>
    <h1>Shows the name of that digit</h1>
    <div>
        <label for="num">Number:</label>
        <input type="number" id="num" />
        <button onclick="execute()">Execute</button>
    </div>
    <div id="js-console"></div>
    <script src="scripts/js-console.js"></script>
    <script>
        function execute()
        {
            var num = jsConsole.readInteger("#num");

            switch (num)
            {
                case 0:
                    jsConsole.writeLine("zero");
                    break;
                case 1:
                    jsConsole.writeLine("one");
                    break;
                case 2:
                    jsConsole.writeLine("two");
                    break;
                case 3:
                    jsConsole.writeLine("three");
                    break;
                case 4:
                    jsConsole.writeLine("four");
                    break;
                case 5:
                    jsConsole.writeLine("five");
                    break;
                case 6:
                    jsConsole.writeLine("six");
                    break;
                case 7:
                    jsConsole.writeLine("seven");
                    break;
                case 8:
                    jsConsole.writeLine("eight");
                    break;
                case 9:
                    jsConsole.writeLine("nine");
                    break;
                default:
                    jsConsole.writeLine("Invalid digit");
                    break;
            }
        }
    </script>
</body>
</html>
